import { IsEmail, IsOptional, IsString, Length } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class LoginUserDto {
  @ApiProperty({ example: '1482983333@qq.com', description: '用户名(邮箱)' })
  @IsString()
  @IsEmail()
  username: string;

  @ApiProperty({
    example: '123abc456',
    description: '密码(6-16位)',
    required: false,
  })
  @IsString()
  @Length(6, 16)
  password?: string;

  @ApiProperty({
    example: '102135',
    description: '6位数组验证码',
    required: false,
  })
  @IsOptional()
  @Length(6)
  @IsString()
  captcha?: string; //验证码
}
